//
//  GSRootTabBarController.m
//  GameSky
//
//  Created by lanou on 16/1/10.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSRootTabBarController.h"
#import "GSNewsViewController.h"
#import "GSStrategyViewController.h"
#import "GSSubscribeViewController.h"

@interface GSRootTabBarController ()

@end

@implementation GSRootTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupChildViewController:[GSNewsViewController class] title:@"新闻" imageName:@"" selectedImageName:@""];
    [self setupChildViewController:[GSStrategyViewController class] title:@"攻略" imageName:@"" selectedImageName:@""];
    [self setupChildViewController:[GSSubscribeViewController class] title:@"订阅" imageName:@"" selectedImageName:@""];
    // 默认显示新闻界面;
    self.selectedIndex = 0;
}
// 添加子控制器方法;
- (void)setupChildViewController:(Class)class title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName {
    // 1.添加一个导航控制器;
    UINavigationController *naviC = [[UINavigationController alloc] initWithRootViewController:[[class alloc] init]];
    [self addChildViewController:naviC];
    // 2.设置导航控制器属性;
    naviC.tabBarItem.title = title;
    naviC.tabBarItem.image = [UIImage imageNamed:imageName];
    naviC.tabBarItem.selectedImage = [UIImage imageNamed:selectedImageName];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
